var myXslStylesheet;
var myXmlData;
var myXslProc;
                    
if(document.implementation.createDocument)
{
    var request = new XMLHttpRequest();
    request.overrideMimeType('text/xml');                    
    request.open("GET", xslFile , false);
    request.send(null);
    myXslStylesheet = request.responseXML;
    request.overrideMimeType('text/xml');      
    request.open("GET", xmlFile, false);
    request.send(null);
    myXmlData = request.responseXML;

	myXslProc = new XSLTProcessor();
    myXslProc.importStylesheet(myXslStylesheet);                    
} else {
	alert('Something is very wrong!');        
}
                    
function doTransformation() {

    if(document.implementation.createDocument) {
        
        myXslProc = new XSLTProcessor();
        myXslProc.importStylesheet(myXslStylesheet);
        myXslProc.setParameter("","query",query);
		myXslProc.setParameter("","type",'notHTML'); 
        
		var fragment = myXslProc.transformToFragment(myXmlData, document);
		        
        var tmpDiv = document.getElementById('main');
        tmpDiv.parentNode.replaceChild(fragment, tmpDiv);
        
    } else { alert('Something is very wrong!'); }
}


function queryGo(q) {
    query = q;
    doTransformation();
}
